﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FJASPX.Service;
using NHibernate.Criterion;
using FJASPX.Framwork.Helper;
using FJASPX.Framwork.Constant;
namespace PlugNT.Cms.Web.Home
{
    public partial class Company : System.Web.UI.Page
    {
        public string Logo { get; set; }

        public IEnterpriseService iEnterpriseService { get; set; }

        public FJASPX.Domain.Enterprise enterprise;

        public IProductService iProductService { get; set; }

        public IProductClassService iProductClassService { get; set; }

        public IUserService iUserService { get; set; }

        public FJASPX.Domain.User user;

        public FJASPX.Domain.Product product;


        private void Filter()
        {
            if (Request.QueryString["User"].IsNull())
            {
                Response.Redirect(Strings.PAGE_ERROR);
            }
            try
            {
                user = iUserService.Get(Request.QueryString["User"].ToInt());
                if (user == null)
                {
                    Response.Redirect(Strings.PAGE_ERROR);
                }
                enterprise = iEnterpriseService.GetByUser(user);
                if (enterprise == null)
                {
                    enterprise = new FJASPX.Domain.Enterprise();
                    enterprise.Name = user.CompanyName;
                    enterprise.Contant = user.RealName;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            Filter();
        }

    }
}